package com.wmx.dubbocustomer.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**********************************
 * @author wmx
 * @date 2019/11/12 15:07
 * @description:
 * @version 1.0
 ************************************/
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    private String handlerErrorInfo(HttpServletRequest request, Exception e) {
        System.out.println("GlobalException成功拦截");
        log.error("{} Exception", request.getRequestURI(), e);
        return e.getMessage();
    }

}
